#include <bits/stdc++.h>

#include <atcoder/all>
#define LL long long
using namespace std;
using namespace atcoder;

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  vector<int> a;

  cin >> n;
  a.resize(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    bool flag = false;
    for (int j = i - 1; j > 0; j--) {
      if (a[j] > a[i]) {
        cout << j << "\n";
        flag = true;
        break;
      }
    }
    if (!flag) {
      cout << "-1\n";
    }
  }
  return 0;
}
